<script setup>
import { queryCustomer } from '@/api/Base/business';
import { queryPurchase } from '@/api/Base/purchase';
import EImage from './EImage.vue';
import { format } from 'date-fns';
import { queryPurchasePCB } from '@/api/Base/PCB';
import { queryCanExternalProductPre } from '@/api/Base/preregister';

const show = defineModel("show", {
    default: true
})
const ExternalProduct = defineModel("ExternalProduct", {
    default: {}
})

const ExternalProductObj = reactive({
    name: "",
    list: [],
    reload: () => {
        //TODO:无限屏
        queryCanExternalProductPre({
            // "page": 1,
            // "pageSize": 99999,
            // "searchNameOrSpec": "",
            // "searchProductNo": "",
            // "searchOriginType": "",
            // "startTime": "2018-12-01 06:58:37",
            // "endTime": "2222-12-11 02:42:13",
            // "status": null,
            // "type": 1
        }).then(res => {
            if (res.code == 0) {
                ExternalProductObj.list = res.data
            }
        })
    }
})

onMounted(() => {
    ExternalProductObj.reload()
})
</script>

<template>
    <van-popup class="h-50vh flex flex-col gap-10" teleport="#app" v-model:show="show" round position="bottom">
        <!-- <van-picker :columns="columns" @cancel="inputData.showType = false" @confirm="onConfirm" /> -->
        <!-- <van-search @search="ExternalProductObj.reload" @cancel="ExternalProductObj.list = []" v-model="ExternalProductObj.name"
            placeholder="请输入PCB关键字" /> -->
        <div class="h-[100%] flex flex-col gap-10 overflow-y-scroll bg-[#f2f4f8] p-10 w-100% rounded-[10px]">

            <div class="border bg-white gap-10 rounded-[10px] p-10 flex"
                v-for="(item, index) in ExternalProductObj.list" :key="index">

                <van-checkbox @click="() => {
                    ExternalProduct = item
                    show = false
                }" v-model="item.check" class="rounded-full"></van-checkbox>

               <EImage :width="'100px'" :photo-url="item.photoUrls" />
               <div>
                    <h1 class="text-[14px] leading-[0px] mx-0 text">{{ item.productNo }}</h1>
                    <div class="flex items-center gap-10">
                        创建人id{{ item.createEmployeeId }}
                        <div class="text-[12px]">数量{{ item.quantity}}</div>
                        <h1 class="text-[12px] text-dark">{{ item.workOrderNumber }}</h1>
                    </div>
                    <div class="text-[14px]">{{ item.createDatatime }}</div>
                </div>
            </div>

        </div>
    </van-popup>
</template>
<style lang="less"></style>